<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="stylesheet" type="text/css" href="../../static/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="../../static/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="../../lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="../../static/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="../../static/h-ui.admin/css/style.css"/>
    <link rel="stylesheet" href="../../lib/pagination/pagination.css">
    <link rel="stylesheet" type="text/css" href="../../ht-css/Project.css"/>
    <link rel="stylesheet" type="text/css" href="../../ht-css/style-q.css"/>
    <link rel="stylesheet" href="../../ht-css/create_rules/create_rules.css">
    <title>创建规则</title>
</head>
<style>
    input[type=number] {
        -moz-appearance:textfield;
    }
    input[type=number]::-webkit-inner-spin-button,
    input[type=number]::-webkit-outer-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }
</style>
<body>
<nav class="breadcrumb">首页 <span class="c-gray en">&gt;</span> <span>促销管理</span> <span class="c-gray en">&gt;</span> 创建小游戏促销活动<a
        class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px ;display:block" href="javascript:location.replace(location.href);"
        title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<article class="page-container">
    <form class="ml-20 mr-20" id="form-member-add">
        <div class="bk-gray bg-1 pt-20">
            <div class="pl-20"><b>活动设置</b></div>
            <table class="table table_li">
                <tbody>
                <tr>
                    <td>
                        <div class="row ml-10 clearfix ">
                            <label class="f-l lh-26 w-200 text-r"><span class="c-red pr-5">*</span><span>活动名称(后台)：</span></label>
                            <input  name="lotteryAfterName" id="lotteryAfterName" maxlength="20" type="text" class="input-text f-l w-250 radius"
                                   placeholder="请输入活动名称(最大20字)" required autocomplete="off">
                        </div>
                        <div class="row ml-10 clearfix matop10">
                            <label class="f-l lh-26 w-200 text-r"><span class="c-red pr-5">*</span><span>活动名称(前台)：</span></label>
                            <input name="lotteryBeforeName" maxlength="10" id="lotteryBeforeName" type="text" class="input-text f-l w-250 radius"
                                   placeholder="请输入活动名称(最大10字)" required autocomplete="off">
                        </div>
                    </td>

                </tr>
                <tr>
                    <td>
                        <div class="row ml-10 clearfix">
                            <label class="f-l lh-26 w-200 text-r"><span class="c-red pr-5">*</span><span>活动时间：</span></label>
                            <div class="formControls col-sm-9" style="width: 305px;margin-left: -10px;">
                                <span class="wstxt"></span>
                                <input type="text" class="workinput wicon input-text radius w-135" id="logmin" autocomplete="off"    placeholder="请选择生效时间" required name="startTime">~
                                </span>
                                <input type="text" class="workinput wicon input-text radius w-135" id="logmax"   autocomplete="off"  placeholder="请选择失效时间" required name="endTime">
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="row ml-10 clearfix">
                            <label class="f-l lh-26 w-200 text-r"><span class="c-red pr-5">*</span><span>平台设置：</span></label>
                            <div class="f-l lh-26">
                                <label class="pl-20"><input  name="platform" value="10" type="checkbox" class="checkbox"
                                                            style="margin:0" required minlength="1" checked disabled="disabled">普通平台</label></div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="row ml-10 clearfix">
                            <label class="f-l lh-26 w-200 text-r"><span class="c-red pr-5">*</span><span>客户设置：</span></label>
                            <div class="f-l lh-26">
                                <label class="pl-20"><input  name="platform" value="10" type="checkbox" class="checkbox"
                                                             style="margin:0" required minlength="1"  checked disabled="disabled">普通会员</label></div>
                            <div class="f-l lh-26">
                            <label class="pl-20"><input  name="platform" value="10" type="checkbox" class="checkbox"
                                                         style="margin:0" required minlength="1"  checked disabled="disabled">认证会员</label></div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="row ml-10 clearfix">
                            <label class="f-l lh-26 w-200 text-r"><span class="c-red pr-5">*</span><span>端口名称：</span></label>
                            <div class="f-l lh-26 requiredbox"  >
                                <label class="pl-20"><input id="applPaidType0" checked disabled="disabled"  name="test[]" value="10,20,30" onclick="check_pay()" type="checkbox" class="checkbox requirckeck  paidTypes"
                                                            style="margin:0" required="required">不限</label>
                                <label class="pl-20"><input id="paidType1" checked disabled="disabled" name="test[]" value="10" type="checkbox" class="checkbox requirckeck paidType paidTypes"
                                                            style="margin:0" required="required">PC端</label>
                                <label class="pl-20"><input  id="paidType2" checked disabled="disabled" name="test[]" value="20" type="checkbox" class="checkbox requirckeck paidType paidTypes"
                                                            style="margin:0" required="required">APP端</label>
                                <label class="pl-20"><input id="paidType3" checked disabled="disabled" name="test[]" value="30" type="checkbox" class="checkbox requirckeck paidType paidTypes"
                                                            style="margin:0" required="required">H5端</label>
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="row ml-10 clearfix">
                            <label class="f-l w-200 text-r"><span>PC端活动定向URL：</span></label>
                            <input id="adPcUrl" style="width: 537px;" name="adPcUrl" disabled="disabled" type="url" class="input-text f-l w-300 radius" maxlength="200" placeholder="请输入PC活动URL">
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="row ml-10 clearfix">
                            <label class="f-l w-200 text-r"><span>APP端活动定向URL：</span></label>
                            <input id="adAppUrl" style="width: 537px;"  name="adAppUrl" type="url" disabled="disabled" class="input-text f-l w-300 radius" maxlength="200" placeholder="请输入APP活动URL">
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="row ml-10 clearfix">
                            <label class="f-l w-200 text-r"><span>H5端活动定向URL：</span></label>
                            <input id="adH5Url" style="width: 537px;" name="adAppUrl" type="url" disabled="disabled" class="input-text f-l w-300 radius" maxlength="200" placeholder="请输入H5活动URL">
                        </div>
                    </td>
                </tr>
                </tbody>
            </table>

            <div class="line mt-10"></div>
            <div class="clearfix mt-10 ml-10 mb-10">  <div class="pl-20"><b>活动规则</b></div></div>
            <div class="pl-20">
                <tr>
                <td>
                    <div class="row clearfix">
                        <label class="f-l lh-26 w-200 text-r"><span class="c-red pr-5">*</span><span>参加要求：</span></label>
                        <div class="f-l lh-26">
                            <label class="pl-20"><input id="joinRequire1"  name="joinRequire" value="10" type="radio" class="checkbox"
                                                         style="margin:0" required  minlength="1" onclick="integral(5)">免费参加</label>
                            <label class="pl-20"><input id="joinRequire2" name="joinRequire" value="20" type="radio" class="checkbox"
                                                        style="margin:0" onclick="integral(4)">新用户注册</label>
                            <label class="pl-20"><input id="joinRequire3"  name="joinRequire" value="30" type="radio" class="checkbox"
                                                         style="margin:0" onclick="integral(1)">消耗积分</label>
                            <label class="pl-20"><input id="joinRequire4"  name="joinRequire" value="40" type="radio" class="checkbox"
                                                         style="margin:0" onclick="integral(2)">累计订单数量<span class="imgicon"></span><span class="hoverstyle">?</span>
                            <span class="hovershow hide">即在活动期间累计的付完款的订单数量，除去交易关闭状态订单数量</span>
                            </label>
                            <label class="pl-20"><input id="joinRequire5"  name="joinRequire" value="50" type="radio" class="checkbox"
                                                         style="margin:0" onclick="integral(3)">累计满金额<span class="imgicon"></span><span class="hoverstyle">?</span>
                                <span class="hovershow hide">即在活动期间累计的付完款的订单金额，除去退款完成状态订单金额</span>
                            </label>
                            <label class="pl-20"><input id="joinRequire6"  name="joinRequire" value="60" type="radio" class="checkbox"
                                                        style="margin:0" onclick="integral(6)">单笔订单满金额</label>

                        </div>
                    </div>
                </td>
            </tr>
                <tr >
                    <td>
                        <div class="row clearfix" style="display: none" id="ordershu">
                            <label class="f-l lh-26 w-200 text-r"><span class="c-red pr-5"></span><span></span></label>
                            <div class="f-l lh-26">
                                <label class="pl-20"><span class="c-red pr-5">*</span>累计购物次数满 &nbsp;<input name="er" id="ordershus" class="bianji" type="text" oninput='this.value=this.value.replace(/^[0]+[0-9]*$/gi,"")' onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" maxlength="4" required autocomplete="off">&nbsp;次
                                </label>
                            </div>
                        </div>

            </td>
            </tr>
                <tr >
                    <td>
                        <div class="row clearfix" style="display: none" id="orderjin">
                            <label class="f-l lh-26 w-200 text-r"><span class="c-red pr-5"></span><span></span></label>
                            <div class="f-l lh-26">
                                <label class="pl-20"><span class="c-red pr-5">*</span>累计金额满 &nbsp;<input name="er" style="    width: 46px;" id="orderjins" class="bianji" type="text" oninput='this.value=this.value.replace(/^[0]+[0-9]*$/gi,"")' onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" maxlength="6" required autocomplete="off">&nbsp;元
                                </label>
                            </div>
                        </div>

                    </td>
                </tr>
                <tr >
                    <td>
                        <div class="row clearfix" style="display: none" id="singleStroke">
                            <label class="f-l lh-26 w-200 text-r"><span class="c-red pr-5"></span><span></span></label>
                            <div class="f-l lh-26">
                                <label class="pl-20"><span class="c-red pr-5">*</span>单笔订单金额满 &nbsp;<input name="er" style="    width: 46px;" id="singleStrokes" class="bianji" type="text" oninput='this.value=this.value.replace(/^[0]+[0-9]*$/gi,"")' onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" maxlength="6" required autocomplete="off">&nbsp;元，获得一次抽奖机会
                                </label>
                            </div>
                        </div>

                    </td>
                </tr>
            <tr >
                <td>
                    <div class="row clearfix" style="display: none" id="integral">
                        <label class="f-l lh-26 w-200 text-r" style="margin-left: -20px;"><span class="c-red pr-5"></span><span></span></label>
                        <div class="f-l lh-26 marleft">
                            <label class="pl-20"><span class="c-red pr-5">*</span>每次消耗 &nbsp;<input name="er" id="integrals" class="bianji"  type="text" oninput='this.value=this.value.replace(/^[0]+[0-9]*$/gi,"")' onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" maxlength="4" required autocomplete="off">&nbsp;积分
                            </label>
                        </div>
                    </div>
                </td>
            </tr>
                <tr>
                    <td>
                        <div class="row clearfix">
                            <label class="f-l lh-26 w-200 text-r"><span class="c-red pr-5">*</span><span>抽奖方式：</span></label>
                            <div class="f-l lh-26">
                                <label class="pl-20"><input id="limitWay1"  name="platforiiim" value="10" type="radio" class="checkbox"
                                                             style="margin:0" required minlength="1" onclick="luckdraw(1)">固定次数</label>
                                <label class="pl-20"><input id="limitWay2" name="platforiiim" value="20" type="radio" class="checkbox"
                                                            style="margin:0"  onclick="luckdraw(2)">周期次数</label>
                            </div>
                        </div>
                    </td>
                </tr>
                <tr >
                    <td>
                        <div class="row clearfix" style="display: none"  id="fixed">
                            <label class="f-l lh-26 w-200 text-r"><span class="c-red pr-5"></span><span></span></label>
                            <div class="f-l lh-26">
                                <label class="pl-20"><span class="c-red pr-5">*</span>每个账号限&nbsp;<input class="bianji"  id="fixeds" type="text" oninput='this.value=this.value.replace(/^[0]+[0-9]*$/gi,"")' onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" maxlength="2" required autocomplete="off">&nbsp;次
                                </label>
                            </div>
                        </div>

                    </td>
                </tr>
                <tr >
                    <td>
                        <div class="row clearfix" style="display: none"  id="cycle">
                            <label class="f-l lh-26 w-200 text-r"><span class="c-red pr-5"></span><span></span></label>
                            <div class="f-l lh-26">
                                <label class="pl-20"><span class="c-red pr-5">*</span>每天每个账号限&nbsp;<input class="bianji"  id="cycles" type="text" oninput='this.value=this.value.replace(/^[0]+[0-9]*$/gi,"")' onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" maxlength="2" required autocomplete="off">&nbsp;次
                                </label><!--正则表达式只能输入小数点后两位onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')"-->
                            </div>
                        </div>

                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="row clearfix">
                            <label class="f-l lh-26 w-200 text-r"><span class="imgicon"></span><span class="hoverstyle">?</span>
                                <span class="hovershow hide" style="width: 184px;margin-left: -86px;">系统自动生成的50个虚拟中奖用户</span>
                                <span class="c-red pr-5">*</span><span>虚拟中奖名单展示：</span></label>
                            <div class="f-l lh-26">
                                <label class="pl-20"><input id="virtualNameDisplay"  checked disabled="disabled"  name="virtualNameDisplay" value="10" type="checkbox" class="checkbox"
                                                             style="margin:0" required minlength="1">显示</label>
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="row clearfix matop10">
                            <label class="f-l lh-26 w-200 text-r"><span class="c-red pr-5">*</span><span>活动规则：</span></label>
                                <div id="editor" class="formControls col-sm-9">
                                </div>
                        </div>
                    </td>
                </tr>
            </div>
            <div class="line mt-10"></div>
            <div class="clearfix mt-10 ml-10 mb-10">   <div class="pl-20"><b>奖品设置</b></div></div>
            <div class="pl-20 ">
                <div class=" mt-10 ml-10 mb-10 clearfix tablebox">
                    <table class="tablestyle" style="margin-left: 66px;">
                        <tr>
                            <th>排序</th>
                            <th>奖品名称</th>
                            <th>奖品展示名称</th>
                            <th>数量</th>
                            <th>获奖概率%<span  class="imgicon"></span><span class="hoverstyle">?</span>
                                <span class="hovershow hide">获奖概率是根据商品数量系统自动计算，总和为100%，保留6位小数四舍五入</span>
                            </th>
                            <th>操作</th>
                        </tr>
                 <tbody id="shunlist">


                 </tbody>
                    </table>
                </div>
             </div>
            <div class="text-c mt-20">
                <input type="submit" onclick="checkForm()" style="margin-left: 47px;" value="确认" class="btn btn-secondary size-S radius">
                <input type="button" onclick="cancelBtn()" style="margin-left: 48px;" value="取消" class="btn btn-secondary size-S radius">
            </div>
        </div>

    </form>
</article>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="../../lib/jquery/1.9.1/jquery.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/layer/2.4/layer.js?rev=@@hash"></script>
<script type="text/javascript" src="../../static/h-ui/js/H-ui.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../static/h-ui.admin/js/H-ui.admin.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/My97DatePicker/4.8/WdatePicker.js?rev=@@hash"></script>
<!--[if lt IE 9]-->
<script type="text/javascript" src="../../lib/html5shiv.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/respond.min.js?rev=@@hash"></script>
<!--[endif]-->
<!--[if IE 6]-->
<script type="text/javascript" src="../../lib/DD_belatedPNG_0.0.8a-min.js?rev=@@hash"></script>
<!--<script type="text/javascript" src="../../static/h-ui/js/H-ui.js?rev=@@hash"></script>-->
<script>DD_belatedPNG.fix('*');</script>
<!--[endif]-->

<!--表单验证-->
<!--<script type="text/javascript" src="../../lib/jquery.validation/1.14.0/validate-methods.js?rev=@@hash"></script>-->
<script type="text/javascript" src="../../lib/jquery.validation/1.14.0/jquery.validate.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/jquery.validation/1.14.0/messages_zh.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/datatables/1.10.0/jquery.dataTables.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/laypage/1.2/laypage.js?rev=@@hash"></script>
<script src="../../ht-js/frame/doT.min.js?rev=@@hash"></script>
<script src="../../ht-js/public.js?rev=@@hash"></script>
<!--验证token-->
<script src="../../ht-js/verifyToken.js?rev=@@hash"></script>
<script src="../../ht-js/Project.js?rev=@@hash"></script>
<!--引入分页-->
<link type="text/css" rel="stylesheet" href="../../ht-js/operation-js/time-js/jedate.css">
<script type="text/javascript" src="../../ht-js/operation-js/time-js/jquery.jedate.js?rev=@@hash"></script>
<script type="text/javascript" src="../../ht-js/operation-js/wangeditor/wangEditor.js?rev=@@hash"></script>

<script src="../../lib/pagination/jquery.pagination.js?rev=@@hash"></script>
<link type="text/css" rel="stylesheet" href="../../ht-js/operation-js/time-js/jedate.css">
<script type="text/javascript" src="../../ht-js/operation-js/time-js/jquery.jedate.js?rev=@@hash"></script>

<script src="../../ht-js/dynamicWarehouse.js?rev=@@hash"></script>
<script type="text/javascript" src="../../lib/Validform/5.3.2/Validform_v5.3.2_min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../ht-js/operation-js/time-js/jquery.jedate.js?rev=@@hash"></script>
<script type="text/javascript" src="../../ht-js/operation-js/wangeditor/wangEditor.js?rev=@@hash"></script>

<script type="text/javascript" charset="utf-8" src="../../ht-js/operation-js/ueditor/ueditor.config.js?rev=@@hash"></script>
<script type="text/javascript" charset="utf-8" src="../../ht-js/operation-js/ueditor/ueditor.all.min.js?rev=@@hash"></script>


<script src="../../ht-js/promotion/create_rules.js?rev=@@hash"></script>

<script type="text/javascript">
    var ue = UE.getEditor('editor',{
        enterTag:'' ,
        autoHeightEnabled: true,
        autoFloatEnabled: true,
        initialFrameWidth: 1000,
        initialFrameHeight:483
    });
    UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
    UE.Editor.prototype.getActionUrl = function(action) {
        if (action == 'uploadimage' || action == 'uploadvideo' || action == 'uploadfile' ) {
            return root.sroreinter.ueditor; //在这里返回我们实际的上传图片地址
        } else {
            return this._bkGetActionUrl.call(this, action);
        }
    }

    $(function(){
        $("#form-member-add").Validform({
            tiptype:2,
            callback:function(form){
                checkForm()
                return false;
            }
        });
    })
    $(".imgicon").on('mouseover',function (e) {
        $(this).next().next().removeClass('hide');
    })
    $(".imgicon").on('mouseout',function (e) {
        $(this).next().next().addClass('hide');
    })
    $(".hoverstyle").on('mouseover',function (e) {
        $(this).next().removeClass('hide');
    })
    $(".hoverstyle").on('mouseout',function (e) {
        $(this).next().addClass('hide');
    })


    function cancelBtn() {
        parent.layer.closeAll();
    }

    var requiredCheckboxes =$(".requiredbox").find('.requirckeck');
    console.log(requiredCheckboxes)
    requiredCheckboxes.on('change', function(e) {
        var checkboxGroup = requiredCheckboxes.filter('[name="' + $(this).attr('name') + '"]');
        var isChecked = checkboxGroup.is(':checked');
        checkboxGroup.prop('required', !isChecked);
    });


    var startdate ='';
    var enddate ='';
    var start = {
        format: 'YYYY-MM-DD hh:mm:ss',
        minDate: $.nowDate().substring(0,$.nowDate().length-8)+"00:00:00",
        clearfun:function(val) {
            start.minDate =$.nowDate().substring(0,$.nowDate().length-8)+"00:00:00";
            start.maxDate ="2099-12-31 23:59:59";
            end.minDate="1900-01-01 00:00:00";
            end.maxDate ="2099-12-31 23:59:59";
        },
        okfun: function(obj){
            startdate=obj.val
            end.minDate = obj.val.substring(0,obj.val.length-8)+"00:00:00";
            //获取当前时间
            var now = new Date();
            var year = now.getFullYear();       //年
            var month = now.getMonth() + 1;     //月
            var day = now.getDate();            //日
            var hh = now.getHours();            //时
            var mm = now.getMinutes();          //分
            var ss = now.getSeconds();           //秒
            var clock = year + "-";
            if(month < 10)
                clock += "0";
            clock += month + "-";

            if(day < 10)
                clock += "0";
            clock += day + " ";
            if(hh < 10)
                clock += "0";
            clock += hh + ":";
            if (mm < 10) clock += '0';
            clock += mm + ":";
            if (ss < 10) clock += '0';
            clock += ss;
            console.log(clock);
            console.log(startdate)
            if(startdate<clock){
                $("#logmin").val("")
                layer.msg("生效时间不能小于当前时间", {icon: 5, time: 1000});
                return false;
            }
            endDates()

        }
    };
    var end = {
        format: 'YYYY-MM-DD hh:mm:ss',
        clearfun:function(val) {
            start.minDate =$.nowDate().substring(0,$.nowDate().length-8)+"00:00:00";
            start.maxDate ="2099-12-31 23:59:59";
            end.maxDate ="2099-12-31 23:59:59";
        },
        okfun: function(obj){
            enddate= obj.val;
            if(enddate<startdate){
                $("#logmax").val("")
                layer.msg("失效时间不能小于生效时间", {icon: 5, time: 1000});
            }

       }
    };
    //这里是日期联动的关键
    function endDates() {
        //将结束日期的事件改成 false 即可
        end.trigger = false;
        $("#logmax").jeDate(end);
    }
    $('#logmin').jeDate(start);
    $('#logmax').jeDate(end);

</script>
</body>
</html>